<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>OnlineColock</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			{{date}}
		</div>
		<script type="text/javascript">
			new Vue(
			{
				el:'#app',
				data:{date:new Date()},
				mounted:function(){
					var _this = this;//此语句是保证_this和this具有相同的功能
					this.timer= setInterval(function (){
						_this.date = new Date();
					},1000
					);
				},
				beforeDestroy:function(){
					if(this.timer){
						clearInterval(this.timer);
					}
				}
			}
			);
			</script>
	</body>
</html>
